package com.leecode.xiehf.page_03;

import java.util.ArrayList;
import java.util.List;
import java.util.Map;
import java.util.TreeMap;

public class Solution_0104 {
    public static void main(String[] args) {
        Solution_0104 solution = new Solution_0104();
        int i = solution.maxDepth(new TreeNode(1));
        System.out.println(i);
    }

    public int maxDepth(TreeNode root) {
        int deep = 0;
        deep = bst(root, 0);
        return deep;
    }

    public int bst(TreeNode node, Integer deep) {
        if (node == null) {
            return deep;
        }
        ++deep;
        return Math.max(bst(node.left, deep), bst(node.right, deep));
    }

    public static class TreeNode {
        int val;
        TreeNode left;
        TreeNode right;

        TreeNode() {
        }

        TreeNode(int val) {
            this.val = val;
        }

        TreeNode(int val, TreeNode left, TreeNode right) {
            this.val = val;
            this.left = left;
            this.right = right;
        }
    }
}
